home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
ATUtilities.lha
/
ATUtilities
/
register.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-09-26
|
4KB
|
211 lines
#ifdef SHAREWARE
/* Kundendaten-Struktur */
struct Kunde
{
UBYTE Vorname[50];
UBYTE Nachname[50];
UBYTE Straße[50];
UBYTE Land[4];
UBYTE Postleitzahl[6];
UBYTE Ort[50];
UBYTE Code[32];
} Kunde;
UBYTE GetCCode();
/* Code eines Strings ermitteln */
UWORD GetStringCode(str,scrambling)
UBYTE *str;
UBYTE scrambling;
{
UWORD i;
UWORD code;
UBYTE q;
code=123;
for(i=0;i<strlen(str);i++)
{
code+=(UWORD)GetCCode(str[i],scrambling);
scrambling++;
}
return(code);
}
#asm
public _GetCCode
_GetCCode:
move.l d1,-(sp)
move.l 8(sp),d0
move.l 12(sp),d1
ror.b d1,d0
not.b d0
bchg #3,d0
bchg #6,d0
addq.b #2,d1
rol.b d1,d0
not.b d0
bchg #1,d0
bchg #4,d0
ror.b #3,d0
not.b d0
ext.w d0
ext.l d0
move.l (sp)+,d1
rts
#endasm
#define UP(x) (UBYTE)(toupper(x))
UWORD GetHexNum(ch)
UBYTE ch;
{
if((UP(ch)>='0') && (UP(ch)<='9')) return((UWORD)(UP(ch)-48));
if((UP(ch)>='A') && (UP(ch)<='F')) return((UWORD)(UP(ch)-55));
return(0);
}
UWORD TestCode(code,num,a,b,c,d)
UBYTE *code;
UWORD num;
UWORD a,b,c,d;
{
UBYTE c1,c2,c3,c4;
UBYTE s1[6],s2[6];
c1=tolower(code[a]);
c2=tolower(code[b]);
c3=tolower(code[c]);
c4=tolower(code[d]);
sprintf(&s1,"%c%c%c%c",c1,c2,c3,c4);
sprintf(&s2,"%04x",num);
if(!(strcmp(&s1,&s2)))
{
#ifdef DEBUG
printf("Code: okay\n");
#endif
return(0);
}
#ifdef DEBUG
printf("Code: %s statt %s\n",&s2,&s1);
#endif
return(100);
}
UWORD GetCodeCode(code)
UBYTE *code;
{
UBYTE s;
UWORD cd,i;
s=1;
cd=174;
for(i=0;i<26;i++)
{
cd+=(UWORD)GetCCode(code[i],s);
s++;
}
}
UWORD TestCodeCode(code,cd,a,b,c,d)
UBYTE *code;
UWORD cd;
UWORD a,b,c,d;
{
UBYTE c1,c2,c3,c4;
UBYTE s1[6],s2[6];
c1=tolower(code[a]);
c2=tolower(code[b]);
c3=tolower(code[c]);
c4=tolower(code[d]);
sprintf(&s1,"%c%c%c%c",c1,c2,c3,c4);
sprintf(&s2,"%04x",cd);
if(!(strcmp(&s1,&s2)))
{
#ifdef DEBUG
printf("CodeCheck: okay\n");
#endif
return(0);
}
#ifdef DEBUG
printf("CodeCheck: %s statt %s\n",&s2,&s1);
#endif
return(100);
}
#define VN1 0
#define VN2 1
#define VN3 2
#define VN4 3
#define NN1 4
#define NN2 5
#define NN3 6
#define NN4 7
#define ST1 8
#define ST2 9
#define ST3 10
#define ST4 11
#define LA1 12
#define LA2 13
#define LA3 14
#define LA4 15
#define PL1 16
#define PL2 17
#define PL3 18
#define PL4 19
#define OR1 20
#define OR2 21
#define OR3 22
#define OR4 23
#define S1 24
#define S2 25
/* Code-Kontrolle */
#define CO1 26
#define CO2 27
#define CO3 28
#define CO4 29
#define CODE_VN 3
#define CODE_NN 13
#define CODE_ST 7
#define CODE_LA 49
#define CODE_PL 5
#define CODE_OR 2
#define CODE_CODE 54
#define PROG_ATKEYBOARD (1L<<0)
#define PROG_DISKTRANSFER (1L<<1)
#define PROG_FILETRANSFER (1L<<2)
#define PROG_JOYMANAGER (1L<<3)
#define PROG_PORTSETUP (1L<<4)
#define PROG_ONLINEHELP 0
#define PROG_UTILITYMAN 0
#define PROG_ATLIB 0
#ifndef REGISTER_NOPROGS
#define SYS_COUNT 8
struct Program
{
UWORD Code;
UBYTE *Name;
} Programs[8]={
PROG_ATKEYBOARD, "ATKeyboard 3.0",
PROG_DISKTRANSFER,"ATUtilities Disk Transfer",
PROG_FILETRANSFER,"ATUtilities File Transfer",
PROG_JOYMANAGER, "ATUtilities Joystick Manager",
PROG_PORTSETUP, "ATUtilities Port Setup",
PROG_UTILITYMAN, "ATUtilities Utility Manager",
PROG_ONLINEHELP, "ATUtilities Online Help",
PROG_ATLIB, "ATUtilities-Library"
};
#endif
#define CHECKSTR(code,str,sc1,sc2) (UWORD)TestCode(code,GetStringCode(str,sc1),sc2,(sc2+1),(sc2+2),(sc2+3))
#define CHECKCODE(code) (UWORD)TestCodeCode(code,GetCodeCode(code),CO1,CO2,CO3,CO4);
#define GETPRG(code) (UWORD)(GetHexNum(code[S1])*16)+GetHexNum(code[S2])
#endif